package com.mmm.order;

import com.mmm.feign.client.DeliveryClient;
import com.mmm.feign.client.UserClient;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * @email 1067559930@qq.com
 * @author: One
 * @date: 2022/03/05
 * @time: 21:10
 */
@EnableFeignClients(clients = {UserClient.class, DeliveryClient.class})
@SpringBootApplication
@MapperScan("com.mmm.order.dao")
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    @Value("${es.ip}")
    private String esIp;


    @Bean
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(RestClient.builder(HttpHost.create(esIp)));
    }
}
